package com.jtzc.aikf.file;

import dev.langchain4j.data.document.Document;
import dev.langchain4j.data.document.DocumentParser;
import dev.langchain4j.data.document.loader.FileSystemDocumentLoader;
import dev.langchain4j.data.document.parser.apache.pdfbox.ApachePdfBoxDocumentParser;

/**
 * @author wu chuang
 * @description
 */
public class DefaultDocumentLoader implements DocumentLoader{

    private DocumentParser documentParser;

    public DefaultDocumentLoader(DocumentParser documentParser) {
        this.documentParser = documentParser;
    }

    @Override
    public Document loadDocument(String filePath) {
        return FileSystemDocumentLoader.loadDocument(
                filePath,
                documentParser
        );
    }
}
